<template>
	<view class="room-check-history-page">
		
		<!-- 日期选择 
		<!-- 列表 -->
		
			<view class="p-list">
				<view class="p-l-item" v-for="(item,i) in list" :key="i" @tap="onViewDetails(item)">
					
					<view class="c_title c-flex jc-between">
						<view class="name">安检时间:{{item.patrolTime ||'--' }}</view>
						<image class="arrow-right" src="@/static/images/index/right-icon.png"></image>
					</view>
					<view class="p-content">
						<view class="p-c-item c-flex " >
							<text>安检地址：</text> <text>{{address}}</text>
						</view>
						<view class="p-c-item c-flex" >
							<text>安检人员：</text> <text>{{item.patrolUser || '--'}}</text>
						</view>
						<view class="p-c-item c-flex " >
							<text>安检结果：</text> <view class="checkStatus" :class="item.patrolResult===0?'unCheck':item.patrolResult===1?'normal':'warn'">{{item.patrolResult ===0?'未安检':item.patrolResult ===1?'安检合格':'安检异常'}}</view>
						</view>
						<view class="p-c-item c-flex" >
							<text>安检合格数：</text> <text>{{item.passCount || 0}}</text>
						</view>	
						<view class="p-c-item c-flex" >
							<text>安检异常数：</text> <text>{{item.failCount || 0}}</text>
						</view>	
					</view>	
					
				</view>
			</view>
		
	</view>
</template>

<script>
	
	
	export default {
		
		data() {
			return {
				
				list:[{name:'腾渊达',phone:'13212345678',type:'民用',addr:'北京海淀'}],
				
				userId:null,
				year:'',
				address:''
				
			};
		},
		onLoad(params) {
			this.userId = params.userId;
			this.year = params.year;
			this.address =params.address;
			uni.setNavigationBarColor({
				backgroundColor:'#f9ead5',
				frontColor: '#000000'
			});
			
			this.initData();
		},
		methods:{
			
			
			initData(){
				uni.showLoading();
				this.$API.liquefiedGasRoomYearCheckRecord({userId:this.userId,year:this.year}).then(res =>{
						uni.hideLoading();
						this.list = res.list;
				}).catch(()=>{
					
				});
			},
			onViewDetails(item){
				let picArr =item.attachments && item.attachments.split(',') || [];
				uni.navigateTo({
					url:'./room-check-detail?item='+JSON.stringify(item)+'&picArr='+JSON.stringify(picArr)+'&type=year'
				})
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	.room-check-history-page{
		position: relative;
		background-image: linear-gradient(rgba(249, 195, 115, .3) 0%, #F9F9F9 100%);
		height: 100%;
		
		.p-list{
			padding: 30rpx 18rpx 0;
			.p-l-item{
				background: #FFFFFF;border-radius: 18rpx;padding: 15rpx 28rpx 10rpx;margin-bottom:20rpx;position:relative;
				.p-content {
					margin: 25rpx 0 10rpx;
				
					.p-c-item {
						font-family: PingFang-SC, PingFang-SC;
						font-weight: 500;
						font-size: 26rpx;
						margin-bottom: 30rpx;
						text:first-child{
							width: 160rpx;
							color: #8B959F;
						}
						text:last-child{
							width: 500rpx;
							color: #333333;
						}
						.checkStatus{
							padding: 0 15rpx;
							//margin-top: 10rpx;
							height: 36rpx;border-radius: 8rpx;transform:skewX(-12deg);font-family: PingFang-SC, PingFang-SC;font-weight: 500;font-size: 20rpx;color: #FFFFFF;line-height: 36rpx;text-align: center;
							view{
								transform:skewX(12deg); 
							}
							
						}
						.normal{
							background: linear-gradient( 180deg, #19C132 0%, #14A92A 100%);
						}
						.warn{
							background: linear-gradient( 180deg, #FF776C 0%, #FE6258 47%, #FD4B41 100%);
						}
						.unCheck{
							background: linear-gradient( 180deg, #F9C373 0%, #FF9A16 100%);
						}

					}	
				}
				.c_title {
					
					padding: 22rpx 0 14rpx 0rpx;
					position: relative;
					font-family: PingFangSC, PingFang SC;
					font-weight: 600;
					font-size: 32rpx;
					color: #000000;
					
					.arrow-right {
						width: 34rpx;
						height: 34rpx;
					}
					
					
				}
				
			}
		}
	}
	
</style>
